//
//  ZM_YYLabLab_TVCell.m
//  YYFMMall
//
//  Created by chenzm on 2019/8/31.
//  Copyright © 2019 YuYou1. All rights reserved.
//

#import "ZM_YYLabLab_TVCell.h"

@interface ZM_YYLabLab_TVCell()

@end


@implementation ZM_YYLabLab_TVCell
#pragma mark - 赋值
-(void)setLeftStr:(NSString *)leftStr{
    _leftStr = leftStr;
    self.leftLbl.text = kIsEmptyStr(leftStr)?@"":leftStr;
}

-(void)setRightStr:(NSString *)rightStr{
    _rightStr = rightStr;
    self.rightLbl.text = kIsEmptyStr(rightStr)?@"":rightStr;
    
}

-(void)setMattLeftStr:(NSMutableAttributedString *)mattLeftStr{
    _mattLeftStr = mattLeftStr;
    self.leftLbl.attributedText = mattLeftStr;
}

-(void)setMattRightStr:(NSMutableAttributedString *)mattRightStr{
    _mattRightStr = mattRightStr;
    self.rightLbl.attributedText = mattRightStr;
}

#pragma mark - Methods


#pragma mark - Intial
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpBaseData];
        [self setUpUI];
    }
    return self;
}

///基本数据设置
-(void)setUpBaseData{
    
}
///添加控件
-(void)setUpUI{
    [self bgV];
    [self lineV];
    [self leftLbl];
    [self rightLbl];
}


#pragma mark - lazyLoad
-(YYLabel *)leftLbl{
    if (!_leftLbl) {
        _leftLbl = [YYLabel new];
        _leftLbl.textAlignment = NSTextAlignmentLeft;
        _leftLbl.textColor = kBlackColor;
        _leftLbl.font = kBoldFont(13);
        [self addSubview:_leftLbl];
        [_leftLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@(15));
            make.bottom.top.equalTo(self);
        }];
    }
    return _leftLbl;
}

-(YYLabel *)rightLbl{
    if (!_rightLbl) {
        _rightLbl = [YYLabel new];
        _rightLbl.textColor = kHexColor(0x959595);
        _rightLbl.textAlignment = NSTextAlignmentRight;
        _rightLbl.font = kFont(11);
        [self addSubview:_rightLbl];
        [_rightLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).offset(-15);
            make.bottom.top.equalTo(self);
            make.left.mas_greaterThanOrEqualTo(self.leftLbl.mas_right).offset(10);
        }];
        [self.leftLbl setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
        [self.rightLbl setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
    }
    return _rightLbl;
}


-(UIView *) bgV {
    if (!_bgV) {
        _bgV = [UIView new];
        _bgV.backgroundColor = kWhiteColor;
        _bgV.hidden = YES;
        [self addSubview:_bgV];
        [_bgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.mas_equalTo(self);
            make.left.mas_equalTo(15);
            make.right.mas_equalTo(-15);
        }];
    }
    return _bgV;
}

-(UIView *) lineV {
    if (!_lineV) {
        _lineV = [UIView new];
        _lineV.backgroundColor = kHexColor(0xEEEEEE);
        _lineV.hidden = YES;
        [self addSubview:_lineV];
        [_lineV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(self);
            make.left.mas_equalTo(15);
            make.right.mas_equalTo(-15);
            make.height.mas_equalTo(0.5);
        }];
    }
    return _lineV;
}

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
